<?php
// 本类由系统自动生成，仅供测试用途
class MonthwaAction extends CommonAction {
    public function index(){
        if(isset($_SESSION['loginUserName'])){
            $this->assign('userName',$_SESSION['loginUserName']);
        }

        /*$curMonth	= intval($_GET['month'])>0?$_GET['month']:intval(date("m"));
        $curYear	= date("Y");
        $this->assign('premonth',$curMonth-1);
        $this->assign('nextmonth',$curMonth+1);
        $this->assign('curmonth',intval(date("m")));
        $this->assign('getmonth',$_GET['month']);*/

        /////////////////////////////////////////////////////
        $curtime    = $_GET['month']?$_GET['month']:date(time());//不是表示当前时间，是当前要显示的时间
        $curYear    = date("Y",$curtime);
        $curWeek    = date("W",$curtime);

        $day 		= getthemonth($curtime);
        $dc         = ($day[1]-$day[0])/60/60/24+1;//当前月的总天数
        $monthStart = $day[0];
        $monthEnd   = $day[1];

        $this->assign('premonth',$curtime-$dc*24*3600);
        $this->assign('nextmonth',$curtime+$dc*24*3600);
        $this->assign('curmonth',date(time()));
        $this->assign('getmonth',$_GET['month']);


        $_SESSION['monthStart']  = $monthStart;
        $_SESSION['monthEnd']    = $monthEnd;

        $list       = array();

        $Monthwa    = M('Monthwa');
        $list       = $Monthwa->where("riqi>=$monthStart and riqi <=$monthEnd")->order("riqi")->select();
    	if($list && isset($_SESSION['loginUserName'])){
            $this->assign('waFlag',1);//用于在模板显示是否使用空白表还是使用数据库数据
        }else{
            $this->assign('waFlag',0);
        }

        //echo json_encode($list)
        $this->assign('list',$list);  

        //以下代码用于显示学校列表
        $School     = M('School');
        $list1      = $School->where('status = 1')->order('sortid')->field('id,sName,sType')->select();//getField('id,sName,sType',":");
        $this->assign('schoolJson',json_encode($list1)); ;

        $this->display();
        return;
    }
    //取得相应日期在教科培中心进行的教研活动次数，以避免地点重复。
    public function getMC(){

    }
}
?>